package com.common_used_class._05random;

import java.util.Random;

/**
 * @Author WaveHi
 * @Date 9/8/2021 下午 5:11
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description Random类的使用
 */
public class TestRandom {

    public static void main(String[] args) {

        //获取Random类的对象
        Random r1 = new Random();

        //或随机获取小写字母
        char c1 = (char)(r1.nextInt(26) + 'a');


        //接收验证码
        StringBuilder sb1 = new StringBuilder();

        //生成
        for(int i = 0;i < 4;i++) {

            sb1.append((char)(r1.nextInt(26) + 'a'));

        }


    }

}
